package com.example.foodwebbackend.service;

import com.example.foodwebbackend.mapper.UserMapper;
import com.example.foodwebbackend.mapper.MerchantMapper;
import com.example.foodwebbackend.mapper.MerchantFoodMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AdminStatsService {

    @Autowired
    private UserMapper userMapper;

    @Autowired
    private MerchantMapper merchantMapper;

    @Autowired
    private MerchantFoodMapper merchantFoodMapper;

    /**
     * 获取总用户数
     */
    public int getTotalUsers() {
        return userMapper.countUsers();
    }

    /**
     * 获取总商家数
     */
    public int getTotalMerchants() {
        return merchantMapper.countMerchants();
    }

    /**
     * 获取总美食数
     */
    public int getTotalFoods() {
        return merchantFoodMapper.findAll().size();
    }
} 